13. Chain Rule & Implicit Differentiation
a. Compositions
By a composition of functions we simply mean that we have a function of a function. Thus, if we have two functions, \(f(x)\) and \(g(x)\), we can form two compositions, \(f(g(x))\) (Read “f of g of x.”) and \(g(f(x))\) (Read “g of f of x.”). We write \(f\circ g\) and \(g\circ f\) for these two compositions. In other words, \[ (f\circ g)(x)=f(g(x)) \qquad \text{and} \qquad (g\circ f)(x)=g(f(x)) \] We read \(f\circ g\) as “f composed with g” or “f following g”.
To evaluate a composition of functions, we evaluate the inner function at a value, then evaluate the outer function at the first result.
Suppose \(f(x)=x^2\) and \(g(x)=4x\), what are \((f\circ g)(3)\) and \((g\circ f)(3)\)?
On the one hand, \(g(3)=12\), and then \((f\circ g)(3)=f(g(3))=f(12)=144\).
On the other hand, \(f(3)=9\), and then \((g\circ f)(3)=g(f(3))=g(9)=36\).
The answers are different!
Suppose \(p(x)=(1+x^2)^3\) and \(q(x)=(1+x^3)^2\), what are \((p\circ q)(2)\) and \((q\circ p)(2)\)?
\(\begin{aligned}
(p\circ q)(2)&=(1+81^2)^3=282\,558\,696\,328 \\
(q\circ p)(2)&=(1+125^3)^2=3\,814\,701\,171\,876
\end{aligned}\)
They're different!
Since \(q(2)=(1+2^3)^2=81\), we have \[ (p\circ q)(2)=p(q(2))=p(81)=(1+81^2)^3=282\,558\,696\,328 \] Since \(p(2)=(1+2^2)^3=125\), we have \[ (q\circ p)(2)=q(p(2))=q(125)=(1+125^3)^2=3\,814\,701\,171\,876 \] These are two very big but different numbers!
The composition can also be evaluated at a variable instead of a number.
Suppose \(f(x)=x^2\) and \(g(x)=4x\), what are \((f\circ g)(x)\) and \((g\circ f)(x)\)?
On the one hand, \(g(x)=4x\), and then \((f\circ g)(x)=f(g(x))=f(4x)=(4x)^2=16x^2\).
On the other hand \(f(x)=x^2\), and then \((g\circ f)(x)=g(f(x))=g(x^2)=4x^2\).
Notice \((f\circ g)(x)\) and \((g\circ f)(x)\) are different functions.
As a check, notice \((f\circ g)(3)=\left.16x^2\right|_{x=3}=16\cdot9=144\).
And \((g\circ f)(3)=\left.4x^2\right|_{x=3}=4\cdot9=36\).
Both of these agree with the first example.
Suppose \(p(x)=(1+x^2)^3\) and \(q(x)=(1+x^3)^2\), what are \((p\circ q)(x)\) and \((q\circ p)(x)\)?
\(\begin{aligned} (p\circ q)(x)&=(1+(1+x^3)^4)^3 \\ (q\circ p)(x)&=(1+(1+x^2)^9)^2 \end{aligned}\)
Since \(q(x)=(1+x^3)^2\), we have \[\begin{aligned} (p\circ q)(x)&=p(q(x))=p((1+x^3)^2)=(1+[(1+x^3)^2]^2)^3 \\ &=(1+(1+x^3)^4)^3 \end{aligned}\] Since \(p(x)=(1+x^2)^3\), we have \[\begin{aligned} (q\circ p)(x)&=q(p(x))=q((1+x^2)^3)=(1+[(1+x^2)^3]^3)^2 \\ &=(1+(1+x^2)^9)^2 \end{aligned}\] These multiply out to two different polynomials!
As a check, notice \[ (p\circ q)(2) =\left.\rule{0pt}{10pt}(1+(1+x^3)^4)^3\right|_{x=2}=(1+81^2)^3 \] And \[ (q\circ p)(2) =\left.\rule{0pt}{10pt}(1+(1+x^2)^9)^2\right|_{x=2}=(1+125^3)^2 \] Both of these agree with exercise 2.
It is confusing for \(f(x)\) and \(g(x)\), to both have the same
variable \(x\). So we frequently write something like
\(z=f(y)\) and \(y=g(x)\). Then \(z=f(g(x))=(f\circ g)(x)\).
Then \(x\) is called the inner variable,
\(y\) is called the intermediate variable
and \(z\) is called the outer variable.
In the formula \(y=g(x)\), \(x\) is independent and \(y\) is dependent.
In the formula \(z=f(y)\), \(y\) is independent and \(z\) is dependent.
Overall, in the formula \(z=(f\circ g)(x)\), \(x\) is independent and
\(z\) is dependent.
Suppose an ant is walking in a straight line on a hot frying pan. The position (in mm) of the ant at time \(t\) (in sec) is \(x(t)=4t\). The temperature of the pan (in \(^\circ\)C) is \(T(x)=40+x^2\). What is the temperature of the pan as seen by the ant at time \(t\)?
\[ (T\circ x)(t)=T(x(t))=40+x(t)^2=40+(4t)^2=40+16t^2 \]
Although \(T\) is really a function of \(x\), scientists frequently write \(T(t)\) for this composition: \[ T(t)=T(x(t))=40+16t^2 \] Even though this is bad notation, scientists do it anyway. We need to be aware of it and we will sometimes do it in this book. Mathematicians call this “abuse of notation”.
A fish is swimming in salt water where the density of salt is \(\delta(x)=(5+x) \dfrac{\text{mg}}{\text{cm}^3}\). If the fish's position is \(x(t)=3+t^2\) where \(t\) is in sec and \(x\) is in cm, what is the density of the salt \(\delta(t)\) at the fish's position at time \(t\)?
By abuse of notation, \(\delta(t)=\delta(x(t))\).
\(\displaystyle \delta(t)=8+t^2\)
We compute the composition: \[ \delta(t)=\delta(x(t))=5+x(t)=5+(3+t^2)=8+t^2 \]
Heading
Placeholder text: Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum